package com.youbug.mall.product_pms.web;

import com.youbug.mall.product_pms.service.IPmsSkuInfoService;
import com.youbug.mall.product_pms.vo.SkuItemVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.concurrent.ExecutionException;

@Controller
public class ItemController {

    @Autowired
    private IPmsSkuInfoService skuInfoService;

    @GetMapping("/{skuId}.html")
    private String skuItem(@PathVariable("skuId") Long skuId,  Model model) throws ExecutionException, InterruptedException {

        SkuItemVo vos = skuInfoService.item(skuId);

        model.addAttribute("item",vos);

        return "item";
    }
}
